<?php

/**
 * Chofer form base class.
 *
 * @method Chofer getObject() Returns the current form's model object
 *
 * @package    KrazyTaxi
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseChoferForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'IDCHOFER'           => new sfWidgetFormInputHidden(),
      'user_id'            => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => false)),
      'IDCOMUNA'           => new sfWidgetFormPropelChoice(array('model' => 'Comuna', 'add_empty' => true)),
      'RUTCHOFER'          => new sfWidgetFormInputText(),
      'NOMBRECHOFER'       => new sfWidgetFormInputText(),
      'APELLIDOPATCHOFER'  => new sfWidgetFormInputText(),
      'APELLIDOMATCHOFER'  => new sfWidgetFormInputText(),
      'EMAILCHOFER'        => new sfWidgetFormInputText(),
      'DIRECCIONCHOFER'    => new sfWidgetFormInputText(),
      'FECHAINGRESOCHOFER' => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'IDCHOFER'           => new sfValidatorChoice(array('choices' => array($this->getObject()->getIdchofer()), 'empty_value' => $this->getObject()->getIdchofer(), 'required' => false)),
      'user_id'            => new sfValidatorPropelChoice(array('model' => 'sfGuardUser', 'column' => 'id')),
      'IDCOMUNA'           => new sfValidatorPropelChoice(array('model' => 'Comuna', 'column' => 'IDCOMUNA', 'required' => false)),
      'RUTCHOFER'          => new sfValidatorString(array('max_length' => 10)),
      'NOMBRECHOFER'       => new sfValidatorString(array('max_length' => 20)),
      'APELLIDOPATCHOFER'  => new sfValidatorString(array('max_length' => 20)),
      'APELLIDOMATCHOFER'  => new sfValidatorString(array('max_length' => 20)),
      'EMAILCHOFER'        => new sfValidatorString(array('max_length' => 40)),
      'DIRECCIONCHOFER'    => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'FECHAINGRESOCHOFER' => new sfValidatorDate(),
    ));

    $this->widgetSchema->setNameFormat('chofer[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Chofer';
  }


}
